home *** CD-ROM | disk | FTP | other *** search
/ NetObjects Fusion 7 / Fusion7.iso / NetObjects Fusion / data1.cab / Language_Resource_-_English / Components / AdBanner / SmashTransition.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-10-18  |  2.1 KB  |  65 lines

  1. import java.awt.image.MemoryImageSource;
  2.  
  3. public class SmashTransition extends BannerTransition {
  4.    static final float FOLDS = 8.0F;
  5.    int[] fillPixels = null;
  6.    int dropAmount;
  7.    int location;
  8.  
  9.    public SmashTransition() {
  10.       super.numOfFrames = 8;
  11.    }
  12.  
  13.    public void finishInit() {
  14.       this.fillPixels = new int[super.imageWidth];
  15.  
  16.       for(int f = 0; f < super.imageWidth; ++f) {
  17.          this.fillPixels[f] = -1;
  18.       }
  19.  
  20.       this.dropAmount = super.imageHeight / super.numOfFrames * super.imageWidth;
  21.       this.location = super.pixelsPerImage - super.imageHeight / super.numOfFrames / 2 * super.imageWidth;
  22.  
  23.       for(int f = super.numOfFrames - 1; f >= 0; --f) {
  24.          try {
  25.             Thread.sleep(100L);
  26.          } catch (InterruptedException var6) {
  27.          }
  28.  
  29.          this.Smash(f + 1);
  30.  
  31.          try {
  32.             Thread.sleep(150L);
  33.          } catch (InterruptedException var5) {
  34.          }
  35.  
  36.          super.frames[f] = super.owner.createImage(new MemoryImageSource(super.imageWidth, super.imageHeight, super.workPixels, 0, super.imageWidth));
  37.          super.owner.prepareImage(super.frames[f], super.owner);
  38.          this.location -= this.dropAmount;
  39.       }
  40.  
  41.       super.workPixels = null;
  42.    }
  43.  
  44.    void Smash(int max_fold) {
  45.       System.arraycopy(super.owner.banners[super.owner.nextBanner].imagePixels, super.pixelsPerImage - this.location, super.workPixels, 0, this.location);
  46.       int height = super.imageHeight - this.location / super.imageWidth;
  47.       float foldOffsetAdder = (float)max_fold * 8.0F / (float)height;
  48.       float foldOffset = 0.0F;
  49.       int foldWidth = super.imageWidth - max_fold;
  50.       float srcYAdder = (float)super.imageHeight / (float)height;
  51.       float srcYOffset = (float)super.imageHeight - srcYAdder / 2.0F;
  52.  
  53.       for(int p = super.pixelsPerImage - super.imageWidth; p >= this.location; p -= super.imageWidth) {
  54.          System.arraycopy(this.fillPixels, 0, super.workPixels, p, super.imageWidth);
  55.          System.arraycopy(super.owner.banners[super.owner.currentBanner].imagePixels, (int)srcYOffset * super.imageWidth, super.workPixels, p + (int)foldOffset, foldWidth);
  56.          srcYOffset -= srcYAdder;
  57.          foldOffset += foldOffsetAdder;
  58.          if ((double)foldOffset < (double)0.0F || foldOffset >= (float)max_fold) {
  59.             foldOffsetAdder *= -1.0F;
  60.          }
  61.       }
  62.  
  63.    }
  64. }
  65.